//
//  CollectCollectionViewCell.m
//  LiangYa_BObject
//
//  Created by dllo on 15/11/2.
//  Copyright © 2015年 YuHao. All rights reserved.
//

#import "CollectCollectionViewCell.h"

@implementation CollectCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageV = [[UIImageView alloc] init];
        [self addSubview:_imageV];
        
        self.tagBtn = [MarkButton buttonWithType:UIButtonTypeSystem];
        _tagBtn.layer.cornerRadius = 10;
        _tagBtn.layer.borderColor = [[UIColor lightGrayColor] CGColor];
        _tagBtn.layer.borderWidth = 2;
        _tagBtn.backgroundColor = [UIColor whiteColor];
        _tagBtn.hidden = YES;
        [self addSubview:_tagBtn];
        
        self.redPointV = [[UIView alloc] init];
        _redPointV.backgroundColor = [UIColor colorWithRed:1.000 green:0.000 blue:0.083 alpha:1.000];
        _redPointV.layer.cornerRadius = 7;
//        _redPointV.hidden = YES;
        [self.tagBtn addSubview:_redPointV];
        
        self.blackV = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
        [self addSubview:_blackV];
        
        self.title = [[UILabel alloc] init];
        _title.textColor = [UIColor whiteColor];
        _title.font = [UIFont systemFontOfSize:14];
        [self addSubview:_title];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    _imageV.frame = self.bounds;
    _blackV.frame = CGRectMake(0, cellHeight - 20, cellWidth, 20);
    _tagBtn.frame = CGRectMake(cellWidth - 30, 10, 20, 20);
    _redPointV.frame = CGRectMake(3, 3, 14, 14);
    _title.frame = CGRectMake(5, cellHeight - 20, cellWidth - 10, 20);
    self.layer.cornerRadius = 5;
    self.clipsToBounds = YES;
}

@end
